package com.huidu.bitrade.entity;

import com.huidu.bitrade.constant.BooleanEnum;
import com.huidu.bitrade.constant.WithdrawStatus;
import com.fasterxml.jackson.annotation.JsonFormat;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;

import javax.persistence.*;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;

/**
 * 提币申请
 *
 * @author QQ：97095646
 * @date 2020年01月29日
 */
@Entity
@Data
public class WithdrawRecord {

    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Id
    private Long id;

    @ApiModelProperty("申请人id")
    private Long memberId;

    @ApiModelProperty("申请总数量")
    @JoinColumn(name = "coin_id", nullable = false)
    @ManyToOne
    private Coin coin;

    @ApiModelProperty("申请总数量")
    @Column(columnDefinition = "decimal(18,8) comment '申请总数量'")
    private BigDecimal totalAmount;

    @ApiModelProperty("手续费")
    @Column(columnDefinition = "decimal(18,8) comment '手续费'")
    private BigDecimal fee;

    @ApiModelProperty("预计到账数量")
    @Column(columnDefinition = "decimal(18,8) comment '预计到账数量'")
    private BigDecimal arrivedAmount;

    @CreationTimestamp
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    @Temporal(TemporalType.TIMESTAMP)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date dealTime;

    @ApiModelProperty("提现状态")
    @Enumerated(EnumType.ORDINAL)
    private WithdrawStatus status = WithdrawStatus.PROCESSING;

    @ApiModelProperty("是否是自动提现")
    @Enumerated(EnumType.ORDINAL)
    private BooleanEnum isAuto;

    @ApiModelProperty("审核人")
    @JoinColumn(name = "admin_id")
    @ManyToOne
    private Admin admin;

    @Enumerated(EnumType.ORDINAL)
    private BooleanEnum canAutoWithdraw;

    @ApiModelProperty("交易编号")
    private String transactionNumber;

    @ApiModelProperty("提现地址")
    private String address;

    private String remark;

    @ApiModelProperty("放币时间")
    private Date issueTime;
}
